package com.nidu.demo.oauth2.mapper.dataobject;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler;
import com.nidu.demo.base.BaseTenantDO;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "sys_oauth2_access_token", autoResultMap = true)
public class OAuth2AccessTokenDO extends BaseTenantDO {

    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 用户编号
     */
    private Long userId;

    /**
     * 用户类型
     */
    private Integer userType;

    /**
     * 访问令牌
     */
    private String accessToken;

    /**
     * 刷新令牌
     */
    private String refreshToken;

    /**
     * 客户端编号
     */
    private Long clientId;

    /**
     * 授权范围
     */
    @TableField(typeHandler = Fastjson2TypeHandler.class)
    private List<String> scopes;

    /**
     * 访问令牌过期时间
     */
    private LocalDateTime expiresTime;

    /**
     * 是否删除
     */
    private Boolean deleted;

}
